package com.gitee.cirnochat.chatai.model.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.gitee.cirnochat.chatai.model.dto.lke.LkeReplyResponse;
import com.gitee.cirnochat.chatai.model.enums.aimessage.ChatRoleType;
import com.gitee.cirnochat.chatai.model.enums.aimessage.MessageType;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.BeanUtils;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 
 * @TableName ai_chat_message
 */
@TableName(value ="ai_chat_message")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class AiChatMessage implements Serializable {
    /**
     * 主键ID
     */
    @TableId(value = "id")
    private Long id;

    /**
     * 会话ID
     */
    @TableField(value = "session_id")
    private Long sessionId;

    /**
     * 记录ID
     */
    @TableField(value = "record_id")
    private String recordId;

    /**
     * 消息内容
     */
    @TableField(value = "content")
    private String content;

    /**
     * 角色: 系统(0)|用户(1)|助手(2)
     */
    @TableField(value = "role")
    private ChatRoleType role;

    /**
     * 模型
     */
    @TableField(value = "model")
    private String model;

    /**
     * 消息类型 : 0-md, 1-doc
     */
    @TableField(value = "message_type")
    private MessageType messageType;

    /**
     * 创建时间
     */
    @TableField(value = "create_time")
    private LocalDateTime createTime;

    /**
     * 更新时间
     */
    @TableField(value = "update_time")
    private LocalDateTime updateTime;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    public AiChatMessage(LkeReplyResponse lkeReplyResponse) {
        BeanUtils.copyProperties(lkeReplyResponse, this);
    }
}